<template>
	<view class="padding30rpx">
		<view v-if="list.length>0">
			<view class="dis align-items line part" v-for="(item,index) in list" :key="index">
				<view>
					<view class="fontSize32rpx">{{item.contentname}}</view>
					<view class="hui99">{{item.creationtime}}</view>
				</view>
				<view class="fontSize40rpx jin u-flex">
					{{item.num>0?'+':''}}{{item.num||''}}
					<image src="../../static/user/bi.png"></image>
				</view>
			</view>
		</view>
		<u-toast ref="uToast" />
		<view v-if="list.length<1" style="padding-top: 400rpx;" class="u-p-b-100">
			<u-empty icon-size="280" text="暂无数据~" src="/static/images/noneList.png"></u-empty>
		</view>
		<view class="u-padding-20" v-else>
			<u-loadmore :status="status" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				status: 'loadmore',
				list: [],
				page: 1,
				pageSize: 10,
			}
		},
		onLoad() {
			this.getList(); //获取申请列表
		},
		onReachBottom() {
			if (this.status != 'nomore') {
				this.status = 'loading';
				setTimeout(() => {
					this.getList();
				}, 500);
			}
		},
		onPullDownRefresh() {
			setTimeout(() => {
				this.page = 1;
				this.list = [];
				this.status = 'loadmore';
				this.getList();
			}, 800);
		},
		methods: {
			getList() {
				this.$http.get('app/CurrencyController/selectUserCurrencyRecord', {
					page: this.page,
					limit: this.pageSize,
				}).then(res => {
					if (res.code == 200) {
						res.data.forEach(e => {
							e.num=e.downcurrency-e.upcurrency
							this.list.push(e)
						})
						if (res.data.length < this.pageSize) this.status = 'nomore';
						else this.status = 'loadmore';
					}
					console.log(this.list);
					uni.stopPullDownRefresh();
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	image {
		width: 31rpx;
		height: 31rpx;
		margin-left: 15rpx;
	}

	.jin {
		color: #FF542C;
	}

	.part {
		padding-bottom: 25rpx;
	}
</style>
